<template>
  <div>{{ people }}</div>
  <div>注入：{{ name }}</div>
  <div>注入：{{ num }}</div>

  <button @click="changeNum">修改Provide传入的数据</button>
  <button @click="changePeople">修改名字</button>
</template>

<script setup>
import { inject } from 'vue'
const name = inject('name')

const num = inject('num')

const changeNum = inject('changeNum')
// const { people } = defineProps({
//   people: {
//     type: Object,
//     default: () => {
//       return {}
//     },
//   },
// })
const { people } = defineProps(['people'])
//声明它要触发的事件
const emit = defineEmits(['changePeople'])
const changePeople = () => {
  emit('changePeople', { name: '韩小小', age: 18 })
}
</script>

<style lang="scss" scoped></style>
